--Function of creating binary column
create or replace procedure meta_add_binary_column(
    --Table id
    a_table_id raw,
    --Column id
    a_column_id raw,
    --Column name
    a_column_name varchar2)
as
    --Table name
    a_table_name varchar2(26);
begin
    p_check_col_not_exists(a_table_id, a_column_id, a_column_name);
         
    a_table_name :=  p_get_table_name(a_table_id);
         
    --Changing the metadata
    insert into meta_binary_columns(column_id, table_id, column_name,
        order_index, customization_level)
    values (a_column_id, a_table_id, a_column_name,
    p_generate_order_index(a_table_id), 1);
         
    --Dropping table view
    p_drop_view_if_exists(a_table_name);
         
    execute immediate 'alter table tbl_' 
    || a_table_name
    || ' add  ' || a_column_name
    || ' blob';
         
    --Creating table view
    p_create_table_view(a_table_id);

end;

--go
